package pl.pelcra.cesar.spider.webcrawler;

import edu.uci.ics.crawler4j.url.WebURL;

/***
 * Class extends from WebURL and implements Comparable interface
 * 
 * @author margielewski
 * 
 */
public class CSWebURL extends WebURL implements Comparable<CSWebURL> {

	private static final long serialVersionUID = 1L;
	private boolean hasData = true;

	public CSWebURL(WebURL webURL) {

		if (webURL != null) {
			super.setURL(webURL.getURL());
			super.setDocid(webURL.getDocid());
			super.setParentDocid(webURL.getParentDocid());
			super.setParentUrl(webURL.getParentUrl());
			super.setDepth(webURL.getDepth());
		} else {
			this.hasData = false;
		}

	}

	/***
	 * overridden method to compare two object of CSWebURL. Compares this object
	 * with the specified object for order.
	 */
	@Override
	public int compareTo(CSWebURL arg0) {
		return super.getURL().compareTo(arg0.getURL());
	}

	/***
	 * 
	 * @return return boolean value, true if base object webURL is not null,
	 *         false if base object webURL is null
	 */
	public boolean hasData() {
		return this.hasData;
	}
}
